#pragma once

#include "global.h"
#include <ArduinoJson.h>
#include <SD.h>
#include <FS.h>

#define CONFIG_PATH "/configuration.json"

#define CONFIG_VERSION "version"
#define CONFIG_NAME "name"
#define CONFIG_WIFI_SSID "wifi_ssid"
#define CONFIG_WIFI_PWD "wifi_pwd"

#define INIT_CONFIG "{\"version\":\"1.0\",\"name\":\"data_camera\",\"wifi_ssid\":\"\",\"wifi_pwd\":\"\"}"

class ConfigService
{
private:
    std::map<string, string> config;
public:
    string getConfig(const char * key);
    void setConfig(const char * key, const char * value);
    void initConfig();
    void loadConfig();
    void saveConfig();
};

extern ConfigService configService;